package main

import (
	"goseckill/common"
	"goseckill/dao"
	"goseckill/rabbitmq"
	"goseckill/service"
	"log"
)

//

func main() {
	// 创建数据库实例
	db,err := common.NewMySQLConn()
	if err!=nil{
		log.Fatal(err)
	}
	// gormDb,err := common.NewGormMysqlConn()
	// if err!=nil{
	// 	log.Fatal(err)
	// }
	productDao := dao.NewProductManager("products",db)
	productService := service.NewProductService(productDao)

	orderDao := dao.NewOrderDao("orders",db)
	orderService := service.NewOrderService(orderDao)

	// 消息队列
	rabbitmqConsumeSimple := rabbitmq.NewRabbitMQSimple("Product")  //队列名Product
	rabbitmqConsumeSimple.ConsumeSimple(orderService, productService)
}